﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Linq;
namespace NNTH
{
    public partial class fBangDiemLop : DevExpress.XtraEditors.XtraForm
    {
        public fBangDiemLop()
        {
            InitializeComponent();
        }

        Data.QLTTNNTHEntities db = new Data.QLTTNNTHEntities();
        private void gridLookUpEdit1_EditValueChanged(object sender, EventArgs e)
        {
            if (gridLookUpEdit1.EditValue!=null)
            {
                var Mlop = gridLookUpEdit1.EditValue.ToString();
                hocVienBindingSource.DataSource = db.HocVien.Where(p=>p.MaLop==Mlop);
            }
        }

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (hocVienBindingSource.List.Count>=1)
            {
                var report = new Reports.reKetQua();
                BindingSource bs = (BindingSource)report.DataSource;
                bs.DataSource = hocVienBindingSource.List;
                report.ShowPreviewDialog();
            }
        }

        private void fBangDiemLop_Load(object sender, EventArgs e)
        {
            lopHocBindingSource.DataSource = db.LopHoc;
        }
    }
}